﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bmz.Laboratory.Workflow.Enums;

namespace Bmz.Laboratory.Workflow.Entity
{
    public class TemplateNode : BaseEntity
    {
        [Key]
        [MaxLength(50)]
        public string Code { get; set; }

        [ForeignKey("ParentNodeCode")]
        public virtual ICollection<TemplateNode> ParentNodes { get; set; }

        [ForeignKey("ChildNodeCode")]
        public virtual ICollection<TemplateNode> ChildNodes { get; set; }

        [MaxLength(50)]
        public string Name { get; set; }

        /// <summary>
        /// 节点类型：起始节点 终点等
        /// </summary>
        public TemplateNodeTypeEnum Type { get; set; }

        [MaxLength(200)]
        public string Description { get; set; }

        /// <summary>
        /// 访问地址
        /// </summary>
        [MaxLength(200)]
        public string Url { get; set; }

        /// <summary>
        /// 进入规则（父节点）：所有 单个
        /// </summary>
        public TemplateNodeInRuleEnum InRule { get; set; }

        /// <summary>
        /// 出去规则（自身）：所有 单个
        /// </summary>
        public TemplateNodeOutRuleEnum OutRule { get; set; }

        /// <summary>
        /// 位置 左
        /// </summary>
        public int PositionLeft { get; set; }

        /// <summary>
        /// 位置 上
        /// </summary>
        public int PositionTop { get; set; }

        [MaxLength(50)]
        public string FlowCode { get; set; }

        [ForeignKey("FlowCode")]
        public virtual TemplateFlow TemplateFlow { get; set; }

        public virtual ICollection<TemplateNodeAccessPermission> TemplateNodeAccessPermissions { get; set; }
    }
}
